<?php include_once("DataProvider.php");?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    
   

<title>jQuery Edit In Place</title>
<style type="text/css">
.jeip-saving {
background-image: url( 'ajax-loa2der.gif' );
background-repeat: no-repeat;
background-position: left;
background-color: #903;
color: #fff;
padding: 0 2px 0 20px;
}

.jeip-mouseover, .jeip-editfield {
background-color: #ffff99;
}

.jeip-savebutton {
background-color: #36f;
color: #fff;
}

.jeip-cancelbutton {
background-color: #000;
color: #fff;
}
</style>
</head>
<body>
<?php $result=DataProvider::ExecuteQuery("select * from loaisanpham where id_loaisanpham=8");
		$row=mysql_fetch_array($result);

?>


<div style="width:500px;">
<form action="test2.php" method="get">
<input type="text" name="txt_tenloai"/>
<input type="submit" value="timkiem" />
</form>
<?php 
if(isset($_REQUEST["txt_tenloai"]))
{
	$sql="select * from sanpham where tensanpham like '%".$_REQUEST["txt_tenloai"]."%'";
$result=DataProvider::ExecuteQuery($sql);
}

?>
</div>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <th scope="col">Tên SP</th>
    <th scope="col">Giá</th>
    <th scope="col">Mô tả</th>
    <th scope="col">Mô tả chi tiết</th>
    <th scope="col">ID Danh Mục</th>
    <th scope="col">Ngày cập nhật</th>
    <th scope="col">Tình trạng</th>
  </tr>
  <?php 
  
  $id_='';
  	while($row=mysql_fetch_array($result))
	{
		$id_=$row['id_sanpham'];
  ?>
  <tr>
 	
    <td ><span id="tensp"><?php echo $row['tensanpham'];?></span></td>
  
   	<td ><span id="gia"><?php echo $row['gia'];?></span></td>
    <td ><span id="mota"><?php echo $row['motasanpham'];?></span></td>
    <td ><span id="motachitiet"><?php if($row['motachitiet']!=""){echo $row['motachitiet'];}else{echo "Chua co";}?></span></td>
    <td ><span id="id_danhmuc"><?php echo $row['id_danhmuc'];?></span></td>
    <td ><span id="ngaycapnhat"><?php echo $row['ngaycapnhat'];?></span></td>
    <td ><span id="tinhtrang"><?php echo $row['tinhtrang'];?></span></td>
  </tr>
 <?php }?>
</table>
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/jeip.js"></script>
<script type="text/javascript">
$( "#tensp" ).eip( "save.php?id_=<?php echo $id_;?>&col=1", { select_text: true } );
$( "#gia" ).eip( "save.php?id_=<?php echo $id_;?>&col=3", { select_text: true } );
$( "#mota" ).eip( "save.php?id_=<?php echo $id_;?>&col=4", { select_text: true } );
$( "#motachitiet" ).eip( "save.php?id_=<?php echo $id_;?>&col=5", { select_text: true,form_type: "textarea" } );
$( "#id_danhmuc" ).eip( "save.php?id_=<?php echo $id_;?>&col=6", { select_text: true } );
$( "#ngaycapnhat" ).eip( "save.php?id_=<?php echo $id_;?>&col=7", { select_text: true } );
$( "#tinhtrang" ).eip( "save.php?id_=<?php echo $id_;?>&col=8", { select_text: true } );


	$( "#text-edit" ).eip( "save.php", { select_text: true } );
	
	$( "#textarea-edit" ).eip( "save.php", { 
		form_type: "textarea"
	} );
	
	$( "#select-edit" ).eip( "save.php", {
		form_type: "select",
		select_options: {
			blue	: "Blue",
			green	: "Green",
			red		: "Red",
			black	: "Black",
			brown	: "Brown",
			white	: "White"
		}
	} );
</script>

</body>
</html>